package io.renren.modules.sell.util;/**
 * @auther MR.M
 * @date 2019/5/5-16:02
 */

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;
import java.util.Date;

/**
 *@ClassName Date2LongSerializer
 *@Descripyion TODO
 *@Author mengjiafeng
 *@Date 2019/5/5 16:02
 *@Version 1.0
 **/
public class Date2LongSerializer extends JsonSerializer<Date> {
    @Override
    public void serialize(Date date, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
       jsonGenerator.writeNumber(date.getTime()/1000);
    }
}
